<?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?>

<script language="javascript" type="text/javascript">
    function submitbutton(pressbutton) {
        var form = document.adminForm;
        if (pressbutton == 'cancel') {
            submitform( pressbutton );
            return;
        }

        if (form.name.value == ""){
            alert('Must have a name');
        }
        else {
            submitform( pressbutton );
        }
    }
</script>

<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
            <td width="100%">
                <span class="sectionname">
                    <?php echo $this->row->getId() ? $this->row->getName() : 'Create a new Club';?>
                </span>
            </td>
        </tr>
    </table>

    <?php
    $ptabs = new mosTabs( 0 );
    $ptabs->startPane( "com_leagueman" );
    $ptabs->startTab("General","General-page");
    ?>
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
        <tr>
            <td width="15%" align="right"><?php label('Name:'); ?></td>
            <td width="85%">
                <input class="inputbox" type="text" name="name" size="64" maxlength="64" value="<?php echo $this->row->getName();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Founded:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="founded" size="64" maxlength="64" value="<?php echo $this->row->getFounded();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Members:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="cntMembers" size="64" maxlength="64" value="<?php echo $this->row->getMembers();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Colors:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="colors" size="64" maxlength="64" value="<?php echo $this->row->getColors();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Address:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="address" size="64" maxlength="64" value="<?php echo $this->row->getAddress();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Zipcode:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="zipcode" size="64" maxlength="64" value="<?php echo $this->row->getZipcode();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('City:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="city" size="64" maxlength="64" value="<?php echo $this->row->getCity();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Country:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="country" size="64" maxlength="64" value="<?php echo $this->row->getCountry();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Homepage:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="internet" size="64" maxlength="64" value="<?php echo $this->row->getHomepage();?>" />
            </td>
        </tr>
    </table>
    <?php
    $ptabs->endTab();
    $ptabs->startTab("Description","Description-page");
    ?>
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
        <tr>
            <td width="80%">
                <textarea name="text" rows="15" cols="100" class="text_area"><?php echo $this->row->getText();?></textarea>
            </td>
        </tr>
    </table>
    <?php
    $ptabs->endTab();
    $ptabs->startTab("Stadium","Stadium-page");
    ?>
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
        <tr>
            <td width="15%" align="right"><?php label('Title:'); ?></td>
            <td width="85%">
                <input class="inputbox" type="text" name="stadiumTitle" size="64" maxlength="64" value="<?php echo $this->row->getStadiumTitle();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Address:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumAddress" size="64" maxlength="64" value="<?php echo $this->row->getStadiumAddress();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Zipcode:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumZipcode" size="64" maxlength="64" value="<?php echo $this->row->getStadiumZipcode();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('City:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumCity" size="64" maxlength="64" value="<?php echo $this->row->getStadiumCity();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('Capacity:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumCapacity" size="64" maxlength="64" value="<?php echo $this->row->getStadiumCapacity();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('GmapLat:'); ?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumGmapLat" size="64" maxlength="64" value="<?php echo $this->row->getGMapLat();?>" />
            </td>
        </tr>
        <tr>
            <td align="right"><?php label('GmapLng:') ;?></td>
            <td>
                <input class="inputbox" type="text" name="stadiumGmapLng" size="64" maxlength="64" value="<?php echo $this->row->getGMapLng();?>" />
            </td>
        </tr>
    </table>
    <?php
    $ptabs->endTab();
    $ptabs->startTab("Logo","Logo-page");
    ?>
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
        <tr>
            <td width="15%" align="right"><?php label('Logo:'); ?></td>
            <td width="85%">
                <input type="file" name="upload" size="40" />
            </td>
        </tr>
        <tr>
            <td align="right">&nbsp;</td>
            <td>
                <?php $this->plugin("thumb", "logos", $this->row->getLogo(), 100, 100);?>
            </td>
        </tr>
    </table>
    <?php
    $ptabs->endTab();
    $ptabs->startTab("Teams","Team-page");
    ?>
    <table class="adminlist">
        <tr>
            <th width="5%" align="center"><?php echo 'Id';?></th>
            <th width="95%" align="left"><?php echo 'Teamname';?></th>
        </tr>
        <?php

        foreach ($this->row->getTeams() AS $row) {
            $t = LM::getLMTable("Team");
            $t->populate($row);

            ?>
        <tr>
            <td align="center"><b><?php echo $t->getID();?></b></td>
            <td><?php echo $t->getName();?></td>
        </tr>
            <?php
        }

        ?>
    </table>
    <?php
    $ptabs->endTab();
    $ptabs->endPane();
    ?>

    <input type="hidden" name="id" value="<?php echo $this->row->getID(); ?>" />
    <input type="hidden" name="option" value="com_leagueman" />
    <input type="hidden" name="act" value="clubs" />
    <input type="hidden" name="task" value="" />
</form>